/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import abstractmodel.IBook;
import abstractmodel.IDetail;
import abstractmodel.IInfo;
import abstractmodel.StatisticsType;
import java.util.ArrayList;

/**
 *
 * @author fightfxj
 */
public abstract class Account  implements abstractmodel.IAccount{

    IBook ownerBook;

    @Override
    public IBook getOwnerBook() {
        return ownerBook;
    }

    public void setOwnerBook(IBook ownerBook) {
        this.ownerBook = ownerBook;
    }
    
    @Override
    public abstract IInfo getAccountInfo();

    @Override
    public abstract boolean setAccountInfo(IInfo info);

    @Override
    public boolean addDetail(IDetail detail) {
        detail.setOwnerAccount(this);
         if (ModelFactory.data.saveDetailInfo(detail.getDetailInfo()))
            return true;
        else 
            return false;       
    }

    @Override
    public abstract boolean deleteDetailInfo(IDetail detail);

    @Override
    public abstract ArrayList<IDetail> getDetailsInfo();

    @Override
    public abstract StatisticsInfo getStatistics(StatisticsType type);

    @Override
    public abstract double getTotalLeftMoney();

    @Override
    public abstract ArrayList<IDetail> searchDetailBetweenDate(String timeBeginString, String timeEndString);

    @Override
    public abstract ArrayList<IDetail> searchDetailInfo(String filter);

}
